<template>
  <div>{{ data.title }}</div>
  <div>{{ name }}</div>
  <button @click="test">点我触发事件</button><br>
  <slot name="school">默认内容</slot>
</template>

<script>
import { reactive } from 'vue';
export default {
  name:'hello',
  props:['name'],
  emits:['demo'],
  setup(props,context){
    console.log("setup~~~~~~~",props)
    console.log("setup~~~~~~~",context)
    let data = reactive({
      title:'helloWorld',
    })
    function test(){
      context.emit('demo')
    }
    return {
      data,
      test
    }
  }
}
</script>

<style>

</style>